<?php

// R�cup�re le informations( nom, mdp,...) � partir de l'id
function model_connexion_user_informations($bdd, $id_user) {
    $id_user = $bdd->quote($id_user);

    $results = $bdd->query(
            'SELECT * FROM users
			INNER JOIN user_type ON users.id_user_type= user_type.id_user_type
			WHERE id_user=' . $id_user
    );

    return $results->fetch(PDO::FETCH_ASSOC);
}

// Verification des identifiants
function model_connexion_check_ids($bdd, $email, $password) {
    $email = $bdd->quote($email);
    $password = $bdd->quote($password);

    $results = $bdd->query(
            'SELECT * FROM users
			INNER JOIN user_type ON users.id_user_type= user_type.id_user_type
			WHERE (`user_login`=' . $email . ' OR `users`.`user_email`=' . $email . ')
			AND `user_password`=' . $password
    );

    $line = $results->fetch(PDO::FETCH_ASSOC);

    return $line;
}

?>